package com.asohofrucol.dto.util;

import com.asohofrucol.dto.ProcessTransferInnovationRegisterDTO;
import com.asohofrucol.model.ComboValue;
import com.asohofrucol.model.ProcessTransferInnovation;
import com.asohofrucol.model.Ruat;

public class ProcessTransferInnovationHelperDto {
	
	public static ProcessTransferInnovationRegisterDTO convertToRegisterDTO(ProcessTransferInnovation processTransferInnovation) {
		ProcessTransferInnovationRegisterDTO processTransferInnovationRegisterDTO = new ProcessTransferInnovationRegisterDTO();
		
		processTransferInnovationRegisterDTO.setActivity((processTransferInnovation.getComboValueActivity()!=null)?processTransferInnovation.getComboValueActivity().getId():null);
		processTransferInnovationRegisterDTO.setDescription(processTransferInnovation.getDescription());
		processTransferInnovationRegisterDTO.setId(processTransferInnovation.getId());
		processTransferInnovationRegisterDTO.setModifiedDate(processTransferInnovation.getModifiedDate());
		processTransferInnovationRegisterDTO.setModifierUser(processTransferInnovation.getModifierUser());
		processTransferInnovationRegisterDTO.setRuatId(processTransferInnovation.getRuat().getId());
		processTransferInnovationRegisterDTO.setSource((processTransferInnovation.getComboValueSource()!=null)?processTransferInnovation.getComboValueSource().getId():null);
		processTransferInnovationRegisterDTO.setSourceOther(processTransferInnovation.getSourceOther());
		processTransferInnovationRegisterDTO.setStatus(processTransferInnovation.getStatus());
		
		return processTransferInnovationRegisterDTO;
	}


	public static ProcessTransferInnovation converRegisterToEntity(ProcessTransferInnovationRegisterDTO processTransferInnovationRegisterDTO) {
		
		ProcessTransferInnovation entity = new ProcessTransferInnovation();
		
		entity.setComboValueActivity(new ComboValue(processTransferInnovationRegisterDTO.getActivity()));
		entity.setComboValueSource(new ComboValue(processTransferInnovationRegisterDTO.getSource()));
		entity.setDescription(processTransferInnovationRegisterDTO.getDescription());
		entity.setId(processTransferInnovationRegisterDTO.getId());
		entity.setModifiedDate(processTransferInnovationRegisterDTO.getModifiedDate());
		entity.setModifierUser(processTransferInnovationRegisterDTO.getModifierUser());
		entity.setRuat(new Ruat(processTransferInnovationRegisterDTO.getRuatId()));
		entity.setSourceOther(processTransferInnovationRegisterDTO.getSourceOther());
		entity.setStatus(processTransferInnovationRegisterDTO.getStatus());

		
		return entity;
	}
}
